package com.bw.medical.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bw.medical.entity.TbDiagnoseEntity;
import com.bw.medical.entity.TbHospitalEntity;
import com.bw.medical.vo.HospitalVo;
import com.bw.medical.vo.Pojo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.Query;

import com.bw.medical.dao.TbDepartmentDao;
import com.bw.medical.entity.TbDepartmentEntity;
import com.bw.medical.service.TbDepartmentService;


@Service("tbDepartmentService")
public class TbDepartmentServiceImpl extends ServiceImpl<TbDepartmentDao, TbDepartmentEntity> implements TbDepartmentService {
    @Autowired
    private TbDepartmentDao tbDepartmentDao;
//    @Override
//    public PageUtils queryPage(Map<String, Object> params,Integer hospitalId) {
//
//        IPage<TbDepartmentEntity> page = this.page(
//                new Query<TbDepartmentEntity>().getPage(params),
//                new QueryWrapper<TbDepartmentEntity>().eq("hospital_id",hospitalId)
//        );
//        PageUtils pageUtils = new PageUtils(page);
//        return pageUtils;
//    }




    @Override
    public IPage<TbDepartmentEntity> getList(Map<String, Object> params) {
        System.out.println((String) params.get("page"));
        System.out.println((String)params.get("limit"));
        System.out.println((String)params.get("departmentName"));
        System.out.println((String)params.get("hospitalId"));

        Page<TbDepartmentEntity> page = new Page<>(Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("limit").toString()));
        return baseMapper.getList(page,(String)params.get("departmentName"),Integer.valueOf(params.get("hospitalId").toString()));
    }


}